package com.thread.threadPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Author milian
 * @Date 2021/7/30 0030 9:13
 */
public class demo1 {
    public static void main(String[] args) throws InterruptedException {
        //创建一个默认线程池对象
        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.submit(()->{
            System.out.println("提交了一个线程");
        });
        Thread.sleep(2000);
        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName());
        });
        executorService.shutdown();
    }
}
